package com.xbts.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xbts.system.domain.PartyPointsDeclaration;
import com.xbts.system.domain.vo.PartyPointsDeclarationVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 活动申报列表Mapper接口
 *
 * @author xbts
 * @date 2023-06-12
 */
public interface PartyPointsDeclarationMapper extends BaseMapper<PartyPointsDeclaration> {

    @Select("select t.belong_to_area belongToArea,t.reward_points rewardPoints,t.`year`,pa.area_name areaName\n" +
            "from party_points_declaration_statistics t\n" +
            "left join party_area pa on t.belong_to_area = pa.area_id\n" +
            "where t.`year` = #{year}\n" +
            "order by t.reward_points desc, t.update_time desc")
    List<PartyPointsDeclarationVo> pointsRanking(String year);
}